| Conditions | 5 |
| Total Lines | 24 |
| Code Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import AbstractMenuItemDispatcher from './AbstractMenuItemDispatcher'; |
||
| 11 | static getMenuItem(schema) { |
||
| 12 | if (!this.isAvailable(schema)) { |
||
| 13 | throw new Error('Table not available in schema!'); |
||
| 14 | } |
||
| 15 | return new MenuItem({ |
||
| 16 | command: (state, dispatch) => { |
||
| 17 | if (!setBlockTypeNoAttrCheck(schema.nodes.table)(state)) { |
||
| 18 | return false; |
||
| 19 | } |
||
| 20 | if (dispatch) { |
||
| 21 | const tableCell = schema.nodes.table_cell.create({}, schema.nodes.paragraph.create()); |
||
| 22 | const rowCells = [tableCell, tableCell.copy(tableCell.content)]; |
||
| 23 | const tableRow = schema.nodes.table_row.create({}, rowCells); |
||
| 24 | const tableRows = [tableRow, tableRow.copy(tableRow.content)]; |
||
| 25 | const tableNode = schema.nodes.table.create({}, tableRows); |
||
| 26 | dispatch(state.tr.replaceSelectionWith(tableNode)); |
||
| 27 | } |
||
| 28 | |||
| 29 | return true; |
||
| 30 | }, |
||
| 31 | icon: svgIcon('table-plus'), |
||
| 32 | label: LANG.plugins.prosemirror['label:table'], |
||
|
|
|||
| 33 | }); |
||
| 34 | } |
||
| 35 | } |
||
| 36 |
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.